//-----------------------------------------------------------------------------
//
// @file	Renderer.h
// @brief	Base class for renderers
// @author	Vinod Melapudi
// @date	20Feb2010
//
//-----------------------------------------------------------------------------

#ifndef _RENDERER_H
#define _RENDERER_H

#include <windows.h>
#include <windowsx.h>

typedef unsigned int	uint;

//
// @class	Renderer
// @brief	Singleton class to support directX render
//
class Renderer
{
public:
	bool			Initialized()	{ return m_initialized; }

	// Public functions to init, render and uninit renderer
	virtual bool	Init( HWND hWnd, int width, int height ) = 0;
	virtual void	PreRender() = 0;
	virtual void	PostRender() = 0;
	virtual void	UnInit() = 0;

	virtual void	HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam ) = 0;
	virtual void	RenderText( const char* str, float x, float y ) = 0;

	// VBO
	virtual inline uint		LoadVBO( uint data_size, void* data ) = 0;
	virtual inline void		BindVBO( uint vbo ) = 0;
	virtual inline void		UnloadVBO( uint *vbo ) = 0;


	// Shaders
#ifdef SHADER_SUPPORT
	virtual bool			LoadShaders( const char *vertexShaderFile, const char * fragmentShaderFile, 
										 uint &vtxShdrID, uint &fragShdrID, uint &shdrProgramID ) = 0;
	virtual void			BindShader( uint shdrProgramID ) = 0;
	virtual void			UnInitShader( uint vtxShdrID, uint fragShdrID, uint shdrProgramID ) = 0;
#endif

protected:
	Renderer()	{	m_initialized = false;	}
	virtual	~Renderer()	{}

	HWND	m_HWnd;			// Window handle
	bool	m_initialized;	// Render status
};


#endif